package com.bootdo.member.commons;
import com.bootdo.member.service.ShequMemberService;
import com.front.web.member.MemberSuperController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class MemberIntegralsUtils extends MemberSuperController {

    /**
     * 通用 加减积分
     * @param integral
     * @param mobile
     * @param type
     * @return
     */
    public boolean updateIntegrals(Double integral, String mobile, int type, ShequMemberService shequMemberService){

        /*ShequMember byMobile = shequMemberService.getByMobile(mobile);*/

            if(type==1){//加积分的操作
                Integer i = shequMemberService.updateIntegerAdd(integral, mobile);
                if(i==null||i<=0){
                    return false;
                }
            }else if(type==2){
                Integer i = shequMemberService.updateIntegerMinus(integral, mobile);
                if(i==null||i<=0){
                    return false;
                }
            }
            return true;
    }
}
